package com.hissy.common.serializer;

import java.lang.ref.SoftReference;

import com.caucho.hessian.io.*;

public class HessionSoftReferenceSerializerFactory extends AbstractSerializerFactory {

    private final SoftReferenceSerializer beanSerializer=new SoftReferenceSerializer();

    private final SoftReferenceDeserializer beanDeserializer=new SoftReferenceDeserializer();

    @Override
    public com.caucho.hessian.io.Serializer getSerializer(@SuppressWarnings("rawtypes") Class cl) throws HessianProtocolException {
        if(SoftReference.class.isAssignableFrom(cl)) {
            return beanSerializer;
        }
        return null;
    }

    @Override
    public Deserializer getDeserializer(@SuppressWarnings("rawtypes") Class cl) throws HessianProtocolException {
        if(SoftReference.class.isAssignableFrom(cl)) {
            return beanDeserializer;
        }
        return null;
    }

}
